#include "Producer.h"
#include "Consumer.h"
#include "TaskQueue.h"

#include <iostream>
#include <thread>

using std::cout;
using std::endl;
using std::thread;

void test()
{
    TaskQueue taskQue(10);

    Producer pro;
    Consumer con;

    thread proTh(&Producer::produce, &pro, std::ref(taskQue));//生产者线程对象
    thread conTh(&Consumer::consume, &con, std::ref(taskQue));//消费者线程对象

    //让主线程等待生产者与消费者线程
    proTh.join();
    conTh.join();
}

int main(int argc, char *argv[])
{
    test();
    return 0;
}

